import time

from selenium.webdriver.chrome import webdriver
from selenium.webdriver.common.by import By
from common.basepage import BasePage
from conf.constant import cons


class SettingPage(BasePage):
    """品牌设置"""
    #brandset_locator = (By.XPATH, '//*[@class="router-link-active"]')
    #品牌设置标签
    brand_Locator=(By.XPATH,'//*[@class = "page-title"]/li[9]')
    #品牌名称输入
    brandname_Locator =(By.XPATH,'//*[@class = "inputBox" and @maxlength = "20" and @type = "text"]')
    #品牌LOGO上传
    Logo_Locator =(By.XPATH,'//*[contains(text(),"品牌logo")]/following-sibling::div')
    #主营类别选择
    category_Locator =(By.XPATH,'//*[@class ="el-input__inner"]')
    #官网地址输入
    Gurl_Locator = (By.XPATH,'//*[contains(text(),"官网地址")]/following-sibling::div/input')
    #客服电话输入
    Telephone_Locator=(By.XPATH,'//*[@onkeyup="this.value=this.value.replace(/[^0-9+-_@#*]+/,'');"]')
    #联系人姓名
    name_Locator = (By.XPATH, '//*[contains(text(),"联系人姓名")]/following-sibling::div/input')
    #联系人电话
    contactor_phone_Locator=(By.XPATH, '//*[contains(text(),"联系人电话")]/following-sibling::div/input')
    #保存按钮
    save_Locator =(By.XPATH,'//*[@class="saveMes"]/p')
    #保存成功提示
    save_success_Locator =(By.XPATH,'//*[@class="el-message__content"]')
    #重新认证
    recetificate_Locater=(By.XPATH,'//*[@class="branded"]')

    '''个人'''
    #主体类型选择公司
    company_Locater = (By.XPATH,'//*[contains(text(),"公司")]')
    #主体类型选择个人
    person_Locater = (By.XPATH,'//*[contains(text(),"个人")]')
    #主体类型选择公益组织
    orginize_Locater = (By.XPATH,'//*[contains(text(),"公益组织")]')
    #个人姓名
    person_name_Locater =(By.XPATH,'//*[contains(text(),"姓名") and @class = "add-left"]')
    #个人身份证
    person_id_Locater = (By.XPATH, '//*[@onkeyup ="this.value=this.value.replace(/[^a-zA-Z0-9]+/,'');"]')
    #门店位置
    location_Locater = (By.XPATH,'//*[@placeholder="请选择所在地区"]')
    #选择具体河北
    location_hebei_Locater=(By.XPATH,'// *[contains(text(), "河北省")]')
    #选择市
    location_SJZ_Locater = (By.XPATH,'//*[contains(text(),"石家庄市")]')
    #选择区
    location_CA_Locater = (By.XPATH,'//*[contains(text(),"长安区")]')
    #详细地址
    define_location_Locater = (By.XPATH,'//*[contains(text(),"详细地址")]/following-sibling::div/input')
    #门头照片
    phontfront_Locater =(By.XPATH,'//*[contains(text(),"门店门头照片")]/following-sibling::div/label/input')
    #收银台照片
    phontcounter_Locater = (By.XPATH, '//*[contains(text(),"收银台照片")]/following-sibling::div/label/input')
    #门店内景照片
    phontinside_Locater = (By.XPATH, '//*[contains(text(),"门店内景照片")]/following-sibling::div/label/input')
    #提交认证
    person_submit_cetificate_Locater = (By.XPATH, '//*[@class="saveMes"]/p[1]')
    #取消认证
    person_cancel_cetificate_Locater = (By.XPATH, '//*[@class="saveMes"]/p[2]')
    '''公司'''
    #法人
    lower_Locater = (By.XPATH, '//*[contains(text(),"法人")]/following-sibling::div/input')
    #企业名称
    companyname_Locater = (By.XPATH, '//*[contains(text(),"企业名称")]/following-sibling::div/input')
    #法人身份证正面
    lower_frontphoto_Locater = (By.XPATH,'//*[contains(text(),"上传正面")]/following-sibling::input')
    # 法人身份证反面
    lower_backphoto_Locater = (By.XPATH, '//*[contains(text(),"上传反面")]/following-sibling::input')
    #营业执照
    licensephoto_Locater = (By.XPATH,'//*[contains(text(),"上传照片")]/following-sibling::input')
    #统一社会信用
    commoncode_Locater = (By.XPATH,'//*[contains(text(),"统一社会信用代码")]/following-sibling::div/input')
    '''公益组织'''
    # 组织名称
    orginizename_Locater = (By.XPATH, '//*[contains(text(),"组织名称")]/following-sibling::div/input')
    # 负责人
    PIC_Locater = (By.XPATH, '//*[contains(text(),"负责人")]/following-sibling::div/input')

    '''会员设置'''
    #会员设置标签
    member_Locater = (By.XPATH,'//*[@class="tab-bar"]/ul/li[contains(text(),"会员设置")]')
    #等级设置
    level_Locater =(By.XPATH,'//*[@class = "page-title"]/li[contains(text(),"等级设置")]')
    # 新增等级
    new_level_Locater = (By.XPATH, '//*[@class = "cur"]')
    # 等级名称
    levelname_Locater = (By.XPATH, '//*[@placeholder="请输入5个字以内等级名称"]')
    # 所需成长值
    growup_number_Locater = (By.XPATH, '//*[@placeholder="请输入大于0的整数数字"]')
    # 生日权益前面勾选框
    click_birthday_Locater = (By.XPATH, '//*[contains(text(),"通用权益")]/ following-sibling::div/label')
    # 服务权益勾选
    server_Locater = (By.XPATH, '//*[@class="dis-count checkAllow"]/label/span[@class = "el-checkbox__input"]')
    # 服务折扣
    server_discount_Locater = (By.XPATH, '//*[@class="dis-count checkAllow"]/div/div/input')
    # 产品权益勾选
    product_Locater = (By.XPATH, '//*[@class="dis-count checkAllow mT10"]/label/span[@class = "el-checkbox__input"]')
    # 产品折扣
    product_discount_Locater = (By.XPATH, '//*[@class="dis-count checkAllow mT10"]/div/div/input')
    # 新增等级中的备注
    level_comment_Locater = (By.XPATH, '//*[@placeholder="请输入200字以内备注"]')
    # 提交按钮
    newlevel_submit_Locater = (By.XPATH, '//*[@class="submit-btn"]/span[1]')
    #添加成功
    addsuccess_Locater =(By.XPATH,'//*[contains(text(),"添加成功")]')
    # 编辑成功
    editsuccess_Locater = (By.XPATH, '//*[contains(text(),"编辑成功")]')
    # 取消按钮
    newlevel_cancel_Locater = (By.XPATH, '//*[@class="submit-btn"]/span[2]')
    # 选择等级第一条数据编辑按钮
    firstedit_btn = (By.XPATH, '//*[@class="cont-tab"]/ul[2]/li/span[1]')
    # 选择第一条数据删除按钮
    seconddelete_btn = (By.XPATH, '//*[@class="cont-tab"]/ul[3]/li/span[2]')
    # 提示中确认按钮
    confirm_Locater = (By.XPATH, '//*[@class ="el-button el-button--default el-button--small el-button--primary "]')
    # 提示中取消按钮
    prompt_cancel_Locater = (By.XPATH, '//*[@class ="el-button el-button--default el-button--small"]')
    # 删除成功提示信息
    delsuccess_Locater = (By.XPATH, '//*[contains(text(),"删除成功")]')
    #成长值设置
    grow_up_Locater = (By.XPATH,'//*[contains(text(),"成长值设置")]')
    #会员成长值启动按钮
    grow_open_Locater = (By.XPATH,'//*[contains(text(),"会员成长值启动状态")]/following-sibling::div/div')
    #成长有效期设置本年
    growdata_Locater = (By.XPATH, '//*[@class="cz"]/label/span[1]/input')
    #成长有效期设置永久
    foreverdata_Locater = (By.XPATH, '//*[contains(text(),"成长值有效期")]/following-sibling::div/p[2]/label/span[1]')
    #购买充值卡点数
    recharge_card_Locater =(By.XPATH,'//*[contains(text(),"购充值卡")]/following-sibling::li/div/div/input')
    # 购买次卡点数
    once_card_Locater = (By.XPATH, '//*[contains(text(),"购买次卡")]/following-sibling::li/div/div/input')
    # 购买折扣卡点数
    discount_card_Locater = (By.XPATH, '//*[contains(text(),"购买折扣卡")]/following-sibling::li/div/div/input')
    # 购买产品点数
    product_con_Locater = (By.XPATH, '//*[@class="tableCon clearfix"][4]/li[2]/div/div/input')
    # 购买服务点数
    server_con_Locater = (By.XPATH, '//*[@class="tableCon clearfix"][5]/li[2]/div/div/input')
    # 购买预约点数
    appointment_con_Locater = (By.XPATH, '//*[@class="tableCon clearfix"][6]/li[2]/div/div/input')
    # 购买套卡点数
    cover_card_Locater = (By.XPATH, '//*[contains(text(),"购买套卡")]/following-sibling::li/div/div/input')
    # 购买时限卡点数
    data_invalid_Locater = (By.XPATH, '//*[contains(text(),"购买时限卡")]/following-sibling::li/div/div/input')
    #会员成长值保存按钮
    growup_save_Locater =(By.XPATH,'//*[contains(text(),"保存")]')
    #修改成功提示
    edit_success_Locater = (By.XPATH,'//*[contains(text(),"修改成功")]')
    #档案设置
    archives_Locater = (By.XPATH,'//*[@class = "page-title"]/li[contains(text(),"档案设置")]')
    #基础信息添加文本
    common_addtext_Locater = (By.XPATH,'//*[contains(text(),"基本信息")]/following-sibling::ul/li/div/b[contains(text(),"添加文本")]')
    #基础信息添加图片
    common_addphoto_Locater = (By.XPATH, '//*[contains(text(),"基本信息")]/following-sibling::ul/li/div/b[contains(text(),"添加图片")]')
    #基础信息添加日期
    common_adddata_Locater = (By.XPATH, '//*[contains(text(),"基本信息")]/following-sibling::ul/li/div/b[contains(text(),"添加日期")]')
    # 私密信息添加文本
    person_addtext_Locater = (
    By.XPATH, '//*[contains(text(),"私密信息")]/following-sibling::ul/li/div/b[contains(text(),"添加文本")]')
    # 私密信息添加图片
    person_addphoto_Locater = (
    By.XPATH, '//*[contains(text(),"私密信息")]/following-sibling::ul/li/div/b[contains(text(),"添加图片")]')
    # 私密信息添加日期
    person_adddata_Locater = (
    By.XPATH, '//*[contains(text(),"私密信息")]/following-sibling::ul/li/div/b[contains(text(),"添加日期")]')
    #数据点击别处
    data_addsuccess =(By.XPATH,'//*[contains(text(),"地址")]')
    #点击添加输入内容标签
    data_input_Locater =(By.XPATH,'//*[@class="tit_l"]/input[@placeholder="请输入内容"]')
    # 点击删除按钮
    data_delete_btn = (By.XPATH, '//*[@class = "del"]')
    #安全码
    savecode_Locater = (By.XPATH,'//*[@class = "page-title"]/li[contains(text(),"安全码")]')
    #安全码启动状态
    savecode_open_Locater =(By.XPATH,'//*[contains(text(),"安全码启动状态")]/following-sibling::div')
    #输入安全码
    savecode_input_Locater = (By.XPATH,'//*[@placeholder ="请输入6位数字的安全码"]')
    #保存按钮
    savecode_submit_Locater = (By.XPATH,'//*[contains(text(),"保存")]')
    #标签设置
    label_Locater = (By.XPATH,'//*[@class = "page-title"]/li[contains(text(),"标签设置")]')
    #新增标签/新增来源
    add_Locater = (By.XPATH,'//*[@class ="addNews"]')
    #标签名称
    labelname_Locater = (By.XPATH,'//*[@placeholder="请输入8个字以内的标签名称"]')
    #累计消费超过点击事件
    cumulative_consumption_Locater = (By.XPATH,'//*[contains(text(),"标签规则")]/following-sibling::div/p[1]/label/span/span')
    #会员数据点击
    cumulative_member_Locater =(By.XPATH,'//*[contains(text(),"标签规则")]/following-sibling::div/p[2]/label/span/span')
    #累计会员数据输入
    cumulative_member_page = (By.XPATH,'//*[@class ="add-right"]/p[2]/input')
    #累计消费金额
    cumulative_money_Locater = (By.XPATH,'//*[@class ="add-right"]/p[1]/input')
    #新增标签确定按钮
    addlabel_submit_Locater = (By.XPATH,'//*[@class = "el-button el-button--primary"]')
    #新增标签取消按钮
    addlabel_cancel_Locater = (By.XPATH,'//*[@class = "el-button el-button--default"]')
    #编辑标签按钮
    editlabel_btn = (By.XPATH,'//*[@class ="tableCon clearfix"][1]//span[contains(text(),"编辑")]')
    #删除标签按钮
    dellabel_btn = (By.XPATH,'//*[@class ="tableCon clearfix"][2]//span[contains(text(),"删除")]')
    #删除中选择确定(标签和来源均可用)
    delconfirm_Locater = (By.XPATH,'//*[@class ="el-button el-button--default el-button--small el-button--primary "]')
    #删除中选择取消（标签和来源均可用）
    delcancel_Locater = (By.XPATH,'//*[@class ="el-button el-button--default el-button--small"]')
    #来源管理
    source_Locater = (By.XPATH,'//*[@class = "page-title"]/li[contains(text(),"来源管理")]')
    #新增来源名称
    source_name_Locater = (By.XPATH, '//*[@placeholder="请输入8个字以内的来源名称"]')
    #新增来源备注
    source_comment_Locater = (By.XPATH, '//*[@placeholder="请输入200字以内备注"]')
    #来源中点击确定按钮
    source_confirm_Locater = (By.XPATH,'//*[@class="el-button el-button--primary"]')
    #来源中点击取消
    source_cancel_Locater = (By.XPATH, '//*[@class="el-button el-button--default"]')
    #编辑来源数据
    edit_source_Locater = (By.XPATH, '//*[@class ="tableCon clearfix"][2]/li/span[contains(text(),"编辑")]')
    #删除来源数据
    delsource_Locater = (By.XPATH, '//*[@class ="tableCon clearfix"][2]/li/span[contains(text(),"删除")]')


    def click_brandset_btn(self):
        '''点击品牌设置'''
        self.visible_only_wait(self.brand_Locator).click()
    def input_brand(self,brandname):
        '''输入品牌名称信息'''
        brandname_elem =self.visible_only_wait(self.brandname_Locator)
        brandname_elem.clear()
        brandname_elem.send_keys(brandname)

    def upload_logo(self):
        '''上传LOGO图片'''
        #self.clickable_wait(self.Logo_Locator).click()
        upload_photo = self.presence_only_wait(self.Logo_Locator)
        # upload_photo.send_keys(r"C:\Users\lbx\Desktop\photo\2.jpg")
        upload_photo.send_keys(cons.IMAGE_PATH)


    def select_category(self):
        '''选择主营类目'''
        self.clickable_wait(self.category_Locator).click()
        category = self.visible_least_wait(self.category_Locator)
        self.random_select_click(category)
    def input_Gurl(self,url):
        '''输入官网地址'''
        url_elem = self.visible_only_wait(self.Gurl_Locator)
        url_elem.clear()
        url_elem.send_keys(url)
    def click_Telephone_btn(self,mobile):
        '''输入客服电话'''
        mobile_elem = self.visible_only_wait(self.Telephone_Locator)
        #mobile_elem.clear()
        mobile_elem.send_keys(mobile)
    def input_name(self,name):
        '''输入联系人姓名'''
        name_elem = self.visible_only_wait(self.name_Locator)
        name_elem.clear()
        name_elem.send_keys(name)
    def input_phone(self,phone):
        '''输入联系人电话'''
        phone_elem = self.visible_only_wait(self.contactor_phone_Locator)
        phone_elem.clear()
        phone_elem.send_keys(phone)
    def click_save_btn(self):
        '''点击保存按钮'''
        self.clickable_wait(self.save_Locator).click()
    def click_recetificate_btn(self):
        '''点击重复认证按钮'''
        self.clickable_wait(self.recetificate_Locater).click()
    def newbrandsetting(self,brandname,url,moblie,name,phone):
        '''新增品牌设置'''
        self.input_brand(brandname)
        self.upload_logo()
        self.select_category()
        self.input_Gurl(url)
        self.click_Telephone_btn(moblie)
        self.input_name(name)
        self.input_phone(phone)
        self.click_save_btn()
    def get_save_success(self):
        return self.presence_only_wait(self.save_success_Locator)
    '''认证页面内容输入方法'''
    def click_person(self):
        self.clickable_wait(self.person_Locater).click()
    def input_personname(self,personname):
        '''输入姓名信息'''
        personname_elem = self.visible_only_wait(self.person_name_Locater)
        personname_elem.clear()
        personname_elem.send_keys(personname)
    def input_personid(self,personid):
        '''输入身份证信息'''
        personid_elem = self.visible_only_wait(self.person_id_Locater)
        personid_elem.clear()
        personid_elem.send_keys(personid)
    def select_location(self):
        '''选择门店位置'''
        self.clickable_wait(self.location_Locater).click()
        self.clickable_wait(self.location_hebei_Locater).click()
        self.clickable_wait(self.location_SJZ_Locater).click()
        self.clickable_wait(self.location_CA_Locater).click()
    def input_define_location(self,dflocation):
        '''输入详细地址'''
        dflocation_elem = self.visible_only_wait(self.define_location_Locater)
        dflocation_elem.clear()
        dflocation_elem.send_keys(dflocation)
    def upload_front(self):
        '''上传门头照片'''
        #self.clickable_wait(self.phontfront_Locater).click()
        upload_photo = self.presence_only_wait(self.phontfront_Locater)
        upload_photo.send_keys(r"C:\Users\lbx\Desktop\photo\1.jpg")
    def upload_inside(self):
        '''上传内景照片'''
        #self.clickable_wait(self.phontinside_Locater).click()
        upload_photo = self.presence_only_wait(self.phontinside_Locater)
        upload_photo.send_keys(r"C:\Users\lbx\Desktop\photo\1.jpg")
    def upload_counter(self):
        '''上传收银台照片'''
        #self.clickable_wait(self.phontcounter_Locater).click()
        upload_photo = self.presence_only_wait(self.phontcounter_Locater)
        upload_photo.send_keys(r"C:\Users\lbx\Desktop\photo\1.jpg")
    def click_submitcetificate(self):
        '''点击提交认证'''
        self.clickable_wait(self.person_submit_cetificate_Locater).click()
    def click_cancel(self):
        '''点击取消按钮'''
        self.clickable_wait(self.person_cancel_cetificate_Locater).click()
    '''公司'''
    def click_company(self):
        self.clickable_wait(self.company_Locater).click()
    def input_lower(self,lower):
        '''输入法人姓名'''
        lower_elem = self.visible_only_wait(self.lower_Locater)
        lower_elem.clear()
        lower_elem.send_keys(lower)
    def input_companyname(self,companyname):
        '''输入企业名称'''
        companyname_elem = self.visible_only_wait(self.companyname_Locater)
        companyname_elem.clear()
        companyname_elem.send_keys(companyname)
    def upload_lowerfront(self):
        '''法人身份证正面/负责人身份证'''
        #self.clickable_wait(self.lower_frontphoto_Locater).click()
        upload_photo = self.presence_only_wait(self.lower_frontphoto_Locater)
        upload_photo.send_keys(r"C:\Users\lbx\Desktop\photo\1.jpg")
    def upload_lowerback(self):
        '''法人身份证反面/负责人身份证'''
        #self.clickable_wait(self.lower_backphoto_Locater).click()
        upload_photo = self.presence_only_wait(self.lower_backphoto_Locater)
        upload_photo.send_keys(r"C:\Users\lbx\Desktop\photo\1.jpg")
    def upload_license(self):
        '''营业执照上传/组织证件'''
        #self.clickable_wait(self.licensephoto_Locater).click()
        upload_photo = self.presence_only_wait(self.licensephoto_Locater)
        upload_photo.send_keys(r"C:\Users\lbx\Desktop\photo\1.jpg")
    def input_commoncode(self,code):
        '''输入统一社会信用码'''
        code_elem = self.visible_only_wait(self.commoncode_Locater)
        code_elem.clear()
        code_elem.send_keys(code)
    '''公益组织'''
    def click_orginize(self):
        self.clickable_wait(self.orginize_Locater).click()
    def input_orginizename(self, orginize):
        '''输入组织名称'''
        organize_elem = self.visible_only_wait(self.orginizename_Locater)
        organize_elem.clear()
        organize_elem.send_keys(orginize)
    def input_PIC(self, PIC):
        '''输入负责人'''
        PICname_elem = self.visible_only_wait(self.PIC_Locater)
        PICname_elem.clear()
    def is_recetificate_exist(self):
        loc = self.isElementPresent(self.recetificate_Locater)
        if loc is True:
            print("元素存在")
        else:
            print("元素不存在")

    def submitperson(self,name,id,dflocation):
        '''提交个人认证'''
        self.visible_only_wait(self.recetificate_Locater).click()
        self.click_person()
        self.input_personname(name)
        self.input_personid(id)
        self.select_location()
        self.input_define_location(dflocation)
        self.upload_front()
        self.upload_inside()
        self.upload_counter()
        self.click_submitcetificate()

    def submitcompany(self,lower,companyname,code,dflocation):
        '''提交公司认证'''
        self.visible_only_wait(self.recetificate_Locater).click()
        self.click_company()
        self.input_lower(lower)
        self.input_companyname(companyname)
        self.upload_lowerfront()
        self.upload_lowerback()
        self.upload_license()
        self.input_commoncode(code)
        self.select_location()
        self.input_define_location(dflocation)
        self.upload_front()
        self.upload_inside()
        self.upload_counter()
        self.click_submitcetificate()
    def submitorginize(self,orginizename,personcare,dflocation):
        '''提交组织认证'''
        self.visible_only_wait(self.recetificate_Locater).click()
        self.click_orginize()
        self.input_orginizename(orginizename)
        self.input_PIC(personcare)
        self.upload_lowerfront()
        self.upload_lowerback()
        self.upload_license()
        self.select_location()
        self.input_define_location(dflocation)
        self.upload_front()
        self.upload_inside()
        self.upload_counter()
        self.click_submitcetificate()
    '''输入信息后取消'''
    def cancelperson(self,name,id,dflocation):
        '''取消个人认证'''
        self.click_person()
        self.input_personname(name)
        self.input_personid(id)
        self.select_location()
        self.input_define_location(dflocation)
        self.upload_front()
        self.upload_inside()
        self.upload_counter()
        self.click_cancel()

    def cancelcompany(self,lower,companyname,code,dflocation):
        '''取消公司认证'''
        self.click_company()
        self.input_lower(lower)
        self.input_companyname(companyname)
        self.upload_lowerfront()
        self.upload_lowerback()
        self.upload_license()
        self.input_commoncode(code)
        self.select_location()
        self.input_define_location(dflocation)
        self.upload_front()
        self.upload_inside()
        self.upload_counter()
        self.click_cancel()
    def cancelorginize(self,orginizename,personcare,dflocation):
        '''取消组织认证'''
        self.click_orginize()
        self.input_orginizename(orginizename)
        self.input_PIC(personcare)
        self.upload_lowerfront()
        self.upload_lowerback()
        self.upload_license()
        self.select_location()
        self.input_define_location(dflocation)
        self.upload_front()
        self.upload_inside()
        self.upload_counter()
        self.click_cancel()
    def click_member_setting(self):
        self.clickable_wait(self.member_Locater).click()

    def click_level_setting(self):
        '''点击等级设置'''
        self.clickable_wait(self.level_Locater).click()

    def click_newlevel_btn(self):
        '''点击新增等级'''
        self.clickable_wait(self.new_level_Locater).click()
    def input_levelname(self,name):
        levelname = self.presence_only_wait(self.levelname_Locater)
        levelname.clear()
        levelname.send_keys(name)
    def input_growup(self,num):
        growup_elem = self.visible_only_wait(self.growup_number_Locater)
        growup_elem.clear()
        growup_elem.send_keys(num)
    def click_birthday(self):
        self.clickable_wait(self.click_birthday_Locater).click()
    def click_product_discount(self):
        self.clickable_wait(self.product_Locater).click()
        product_elem = self.visible_only_wait(self.product_discount_Locater)
        product_elem.clear()
        product_elem.send_keys("8")
    def click_server_discount(self):
        self.clickable_wait(self.server_Locater).click()
        server_elem = self.visible_only_wait(self.server_discount_Locater)
        server_elem.clear()
        server_elem.send_keys("7")
    def input_comment(self,comment):
        server_elem = self.visible_only_wait(self.level_comment_Locater)
        server_elem.clear()
        server_elem.send_keys(comment)
    def click_level_submit(self):
        self.clickable_wait(self.newlevel_submit_Locater).click()
    def get_add_success(self):
        return self.presence_only_wait(self.addsuccess_Locater)
    def new_level(self,name,num,comment):
        '''新增等级'''
        self.click_level_setting()
        self.click_newlevel_btn()
        self.input_levelname(name)
        self.input_growup(num)
        self.click_birthday()
        self.click_server_discount()
        self.click_product_discount()
        self.input_comment(comment)
        self.click_level_submit()
    def click_one_level(self):
        '''编辑第一条数据提交'''
        self.clickable_wait(self.firstedit_btn).click()
    def edit_one_level(self,name,comment):
        self.click_one_level()
        self.input_levelname(name)
        self.click_birthday()
        self.input_comment(comment)
        self.click_level_submit()
        time.sleep(3)
    def get_edit_success(self):
        return self.presence_only_wait(self.editsuccess_Locater)
    def click_del_level(self):
        '''第二条数据选择删除按钮'''
        self.clickable_wait(self.seconddelete_btn).click()
    def click_cancel_btn(self):
        self.clickable_wait(self.prompt_cancel_Locater).click()
    def click_confirm_btn(self):
        self.clickable_wait(self.confirm_Locater).click()
    def del_one_level(self):
        self.click_del_level()
        self.click_confirm_btn()
    def get_del_success(self):
        return self.presence_only_wait(self.delsuccess_Locater)
    def click_growup_setting(self):
        '''点击成长值设置'''
        self.clickable_wait(self.grow_up_Locater).click()
    def click_open_btn(self):
        '''点击会员成长值开启按钮'''
        self.clickable_wait(self.grow_open_Locater).click()
    def click_growupdata(self):
        self.clickable_wait(self.growdata_Locater).click()
    def click_forever(self):
        self.clickable_wait(self.foreverdata_Locater).click()
    def input_recharge_card(self,num1):
        input_elem = self.presence_only_wait(self.recharge_card_Locater)
        input_elem.clear()
        input_elem.send_keys(num1)
    def input_once_card(self,num2):
        input_elem = self.presence_only_wait(self.once_card_Locater)
        input_elem.clear()
        input_elem.send_keys(num2)
    def input_discount_card(self,num3):
        input_elem = self.presence_only_wait(self.discount_card_Locater)
        input_elem.clear()
        input_elem.send_keys(num3)
    def input_product(self,num4):
        input_elem = self.presence_only_wait(self.product_con_Locater)
        input_elem.clear()
        input_elem.send_keys(num4)
    def input_server(self,num5):
        input_elem = self.presence_only_wait(self.server_con_Locater)
        input_elem.clear()
        input_elem.send_keys(num5)
    def input_appointment(self,num6):
        input_elem = self.presence_only_wait(self.appointment_con_Locater)
        input_elem.clear()
        input_elem.send_keys(num6)
    def input_conver_card(self,num7):
        input_elem = self.presence_only_wait(self.cover_card_Locater)
        input_elem.clear()
        input_elem.send_keys(num7)
    def input_data_card(self,num8):
        input_elem = self.presence_only_wait(self.data_invalid_Locater)
        input_elem.clear()
        input_elem.send_keys(num8)
    def growup_save_btn(self):
        self.clickable_wait(self.growup_save_Locater).click()
    def get_growedit_success(self):
        return self.presence_only_wait(self.edit_success_Locater)
    def open_member_growup(self,num1,num2,num3,num4,num5,num6,num7,num8):
        '''点击成长值设置进行会员成长值设置'''
        self.click_growup_setting()
        self.click_open_btn()
        self.click_forever()
        self.input_recharge_card(num1)
        self.input_once_card(num2)
        self.input_discount_card(num3)
        self.input_product(num4)
        self.input_server(num5)
        self.input_appointment(num6)
        self.input_conver_card(num7)
        self.input_data_card(num8)
        self.growup_save_btn()
    def click_archives_setting(self):
        self.clickable_wait(self.archives_Locater).click()
    def click_savecode_setting(self):
        self.clickable_wait(self.savecode_Locater).click()
    def click_common_adddata(self):
        self.clickable_wait(self.common_adddata_Locater).click()
    def click_common_addphoto(self):
        self.clickable_wait(self.common_addphoto_Locater).click()
    def click_common_addtext(self):
        self.clickable_wait(self.common_addtext_Locater).click()
    def click_person_adddata(self):
        self.clickable_wait(self.person_adddata_Locater).click()
    def click_person_addphoto(self):
        self.clickable_wait(self.person_addphoto_Locater).click()
    def click_person_addtext(self):
        self.clickable_wait(self.person_addtext_Locater).click()
    def click_inputdata(self,data):
        data_elem = self.presence_only_wait(self.data_input_Locater)
        data_elem.clear()
        data_elem.send_keys(data)
    def del_data(self):
        self.clickable_wait(self.data_delete_btn).click()
    def add_success(self):
        self.clickable_wait(self.data_addsuccess).click()
    def common_text(self,data1):
        self.click_common_addtext()
        self.click_inputdata(data1)
        self.add_success()
        self.del_data()
        time.sleep(2)
    def common_photo(self,data2):
        self.click_common_addphoto()
        self.click_inputdata(data2)
        self.add_success()
        self.del_data()
        time.sleep(2)
    def common_data(self,data3):
        self.click_common_adddata()
        self.click_inputdata(data3)
        self.add_success()
        self.del_data()
        time.sleep(2)
    def person_text(self,data4):
        '''添加文本然后删除'''
        self.click_person_addtext()
        self.click_inputdata(data4)
        self.add_success()
        self.del_data()
        time.sleep(2)
    def person_photo(self,data5):
        '''添加图片然后删除'''
        self.click_person_addphoto()
        self.click_inputdata(data5)
        self.add_success()
        self.del_data()
        time.sleep(2)
    def person_data(self,data6):
        '''添加日期然后删除'''
        self.click_person_adddata()
        self.click_inputdata(data6)
        self.add_success()
        self.del_data()

    def archives_setting(self,data1,data2,data3,data4,data5,data6):
        '''档案设置页面进行添加文本，后删除再次进行别的新增'''
        self.click_archives_setting()
        self.common_text(data1)
        self.common_photo(data2)
        self.common_data(data3)
        self.person_text(data4)
        self.person_photo(data5)
        self.person_data(data6)

    def input_save_code(self,code):
        code_elem = self.presence_only_wait(self.savecode_input_Locater)
        code_elem.clear()
        code_elem.send_keys(code)
    def savecode_submit(self):
        self.clickable_wait(self.savecode_submit_Locater).click()
    def save_code(self,code):
        '''点击安全码进行安全码输入未写入判断'''
        self.click_savecode_setting()
        self.input_save_code(code)
        self.savecode_submit()
    def click_label_setting(self):
        self.clickable_wait(self.label_Locater).click()
    def click_new_label(self):
        self.clickable_wait(self.add_Locater).click()
    def input_labelname(self,name):
        label_name = self.presence_only_wait(self.labelname_Locater)
        label_name.clear()
        label_name.send_keys(name)
    def click_cumu_con(self):
        self.clickable_wait(self.cumulative_consumption_Locater).click()
    def input_cumulative(self,money):
        cumu_elem = self.presence_only_wait(self.cumulative_money_Locater)
        cumu_elem.clear()
        cumu_elem.send_keys(money)
    def click_cumu_member(self):
        '''点击累计会员勾选框'''
        self.clickable_wait(self.cumulative_member_Locater).click()
    def input_cumulative_member_page(self,page):
        '''进行累计会员信息输入'''
        cumu_elem = self.presence_only_wait(self.cumulative_member_page)
        cumu_elem.clear()
        cumu_elem.send_keys(page)
    def newlabel_submit(self):
        self.clickable_wait(self.addlabel_submit_Locater).click()

    def click_edit_label(self):
        '''点击编辑标签按钮'''
        self.clickable_wait(self.editlabel_btn).click()
    def click_del_label(self):
        '''点击删除标签按钮'''
        self.clickable_wait(self.dellabel_btn).click()
    def del_confirm(self):
        '''点击删除后确认按钮'''
        self.clickable_wait(self.delconfirm_Locater).click()
    def new_label(self,name,money):
        '''点击新增标签输入信息提交'''
        self.click_label_setting()
        self.click_new_label()
        self.input_labelname(name)
        self.click_cumu_con()
        self.input_cumulative(money)
        self.newlabel_submit()
        time.sleep(3)
    def edit_label(self,name,page):
        '''修改标签事件'''
        self.click_label_setting()
        self.click_edit_label()
        self.input_labelname(name)
        self.click_cumu_member()
        self.input_cumulative_member_page(page)
        self.newlabel_submit()
        time.sleep(3)
    def del_label(self):
        '''删除标签确认'''
        self.click_label_setting()
        self.click_del_label()
        self.del_confirm()
    def click_source_setting(self):
        self.clickable_wait(self.source_Locater).click()
    def click_new_source(self):
        self.clickable_wait(self.add_Locater).click()
    def input_sourcename(self,name):
        source_elem = self.presence_only_wait(self.source_name_Locater)
        source_elem.clear()
        source_elem.send_keys(name)
    def input_source_comment(self,comment):
        source_elem = self.presence_only_wait(self.source_comment_Locater)
        source_elem.clear()
        source_elem.send_keys(comment)
    def click_source_confirm(self):
        self.clickable_wait(self.source_confirm_Locater).click()
    def click_edit_source(self):
        '''编辑来源'''
        self.clickable_wait(self.edit_source_Locater).click()
    def click_del_source(self):
        '''删除来源'''
        self.clickable_wait(self.delsource_Locater).click()
    def new_source(self,name,comment):
        '''新增来源提交'''
        self.click_source_setting()
        self.click_new_source()
        self.input_sourcename(name)
        self.input_source_comment(comment)
        self.click_source_confirm()
    def edit_source(self,name,comment):
        '''编辑来源信息'''
        self.click_source_setting()
        self.click_edit_source()
        self.input_sourcename(name)
        self.input_source_comment(comment)
        self.click_source_confirm()
    def del_source(self):
        '''删除来源确认'''
        self.click_source_setting()
        self.click_del_source()
        self.del_confirm()